/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biofilter.records.NimbleGen;

import biofilter.exceptions.InvalidRecordException;
import biofilter.records.*;
import biofilter.sources.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Daniel Quest
 * @date   Jan 5 2009
 */
public class NimbleGenSeqRecordTest {

    RecordsFile rf = null;
    NimbleGenSeqRecord instance = null;
    public NimbleGenSeqRecordTest() {
            
        try {
            String seqFile = "test/testdata/NimbleGen/example_OID21551_probes.seqs";
            //rf = new RecordsFile(seqFile, "biofilter.records.NimbleGen.NimbleGenSeqRecord");
            rf = new RecordsFile(seqFile, "biofilter.records.NimbleGen.NimbleGenSeqRecord");
            rf.setHeaderKeyword("PROBE_SEQUENCE");
            //System.err.println( "biofilter.records.NimbleGen.NimbleGenSeqRecord");
            if(rf.eof() == false) {
                //System.out.println("eof is false, got a valid " + rf.getClass().getSimpleName());
                if(rf == null) System.out.println("rf is null");
                //System.out.println (rf.getRecord().getClass() );
                rf.getRecord();
                instance = (NimbleGenSeqRecord) rf.getRecord();
                //System.out.println("done calling getRecord");
                //System.out.println("foo" + instance.getClass().toString());
            }
            else {
                System.out.println("eof returned true");
            }
        } catch (InvalidRecordException ex) {
            System.err.println("error");
        }
            
    }


    @BeforeClass
    public static void setUpClass() throws Exception {

    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }


    @Test
    public void testGet(){
        System.out.println("get");
        String expResult = "CGTATCCCGCCTAAAGCCGTAAATGCAGCGCAAATTGGTTGATATGTATAGGAAAAA	CP000568FS000000001	CP000568:1-3843301	1	interval rank	target_tm:76.00;probe_tm:76.60;freq: 1.02;count:01;rules:0000;score:0989	experimental	76.6	 1.02	   0	 989	1";
        assertEquals(instance.get(), expResult);
    }
    /**
     * Test of getDesignNote method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetDesignNote() {
        System.out.println("getDesignNote");        
        String expResult = "interval rank";
        System.err.println(instance.getDesignNote());
        String result = instance.getDesignNote();
        assertEquals(expResult, result);
    }

    /**
     * Test of getFrequency method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetFrequency() {
        System.out.println("getFrequency");
        double expResult = 1.02;
        double result = instance.getFrequency();
        assertEquals(expResult, result, 0.0);
    }

    /**
     * Test of getPosition method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetPosition() {
        System.out.println("getPosition");
        int expResult = 1;
        int result = instance.getPosition();
        assertEquals(expResult, result);
    }

    /**
     * Test of getProbeClass method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetProbeClass() {
        System.out.println("getProbeClass");
        String expResult = "experimental";
        String result = instance.getProbeClass();
        assertEquals(expResult, result);
    }


    /**
     * Test of getProbeID method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetProbeID() {
        System.out.println("getProbeID");
        String expResult = "CP000568FS000000001";
        String result = instance.getProbeID();
        assertEquals(expResult, result);
    }


    /**
     * Test of getProbeSequence method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetProbeSequence() {
        System.out.println("getProbeSequence");
        String expResult = "CGTATCCCGCCTAAAGCCGTAAATGCAGCGCAAATTGGTTGATATGTATAGGAAAAA";
        String result = instance.getProbeSequence();
        assertEquals(expResult, result);
    }


    /**
     * Test of getProbeTM method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetProbeTM() {
        System.out.println("getProbeTM");
        double expResult = 76.6;
        double result = instance.getProbeTM();
        assertEquals(expResult, result, 0.0001);
    }

    /**
     * Test of getRank method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetRank() {
        System.out.println("getRank");
        int expResult = 1;
        int result = instance.getRank();
        assertEquals(expResult, result);
    }


    /**
     * Test of getRules method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetRules() {
        System.out.println("getRules");
        int expResult = 0;
        double result = instance.getRules();
        assertEquals(expResult, result, 0.0001);
    }


    /**
     * Test of getScore method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetScore() {
        System.out.println("getScore");
        double expResult = 989.0;
        double result = instance.getScore();
        assertEquals(expResult, result, 0.0001);
    }


    /**
     * Test of getSelectionCriteria method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetSelectionCriteria() {
        System.out.println("getSelectionCriteria");
        String expResult = "target_tm:76.00;probe_tm:76.60;freq: 1.02;count:01;rules:0000;score:0989";
        String result = instance.getSelectionCriteria();
        assertEquals(expResult, result);
    }


    /**
     * Test of getSeqID method, of class NimbleGenSeqRecord.
     */
    @Test
    public void testGetSeqID() {
        System.out.println("getSeqID");
        String expResult = "CP000568:1-3843301";
        String result = instance.getSeqID();
        assertEquals(expResult, result);
    }


}